<%@ page language="java" contentType="text/html; charset=UTF-8"    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec"    uri="http://www.springframework.org/security/tags"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<sec:authentication property="principal" var="currentPrincipal" scope="page" />

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>

</head>

<body class="ms-theme-blue">

  <%@ include file="/WEB-INF/include/header.jsp"%>
    
  <%@ include file="/WEB-INF/include/submenu.jsp"%>
  
  <div class="container-fluid ms-container has-ms-sidemenu">
    
    <ol class="ms-breadcrumb breadcrumb">
      <li class="active">回单确认</li>
    </ol>
    
    <div class="ms-content-layout">
    
      <div class="block-heading">
        <h5>回单确认列表</h5>
      </div>
      
      <form class="form-horizontal ms-form form-personal-info" method="POST" action="${ctx.host}/reimburses" data-redirect="${ctx.host}/reimburses/search">
      
        <c:forEach items="${dispatchOrderIds}" var="id">
          <input type="hidden" name="dispatchOrderIds" value="${id}">
        </c:forEach>
        
        <table class="table table-hover ms-table shipment-car-table">
          <thead>
            <tr>
              <th><input type="checkbox" id="select-all" /></th>
              <th>VIN码</th>
              <th>数量</th>
              <th>车型</th>
              <th>颜色</th>
              <th>运输方式</th>
              <th>装车道号</th>
              <th>制造商</th>
              <th>起始地</th>
              <th>目的地</th>
              <th>目的地地址</th>
              <th>目的地联系电话</th>
              <th>预计起运时间</th>
              <th>预计装运时间</th>
              <th>是否电子回单确认</th>
            </tr>
          </thead>
          <tbody>
            <c:forEach items="${shipmentOrders}" var="order">
            
              <c:forEach items="${order.shipmentOrderItems}" var="item">
              
                <tr>
                  <td>
                    <c:choose>
                      <c:when test="${not item.accomplishConfirm}">
                        <input type="checkbox" name="shipmentOrderItems" value="${item.id}-${order.dispatchOrderId}"/>
                      </c:when>
                      <c:when test="${item.accomplishConfirm}">
                        <span class="glyphicon glyphicon-ok"></span>
                      </c:when>
                    </c:choose>
                  </td>
                  <td>${item.vinCode}</td>
                  <td>${item.quantity}</td>
                  <td>${item.carType}</td>
                  <td>${item.carColor}</td>
                  <td>${item.transType}</td>
                  <td>${item.driveWay}</td>
                  <td>${item.manufactor}</td>
                  <td>${item.startFacility}</td>
                  <td>${item.endFacility}</td>
                  <td>${item.destinationAddress}</td>
                  <td>${item.destinationTelecomNumber}</td>
                  <td>${item.deptDate}</td>
                  <td>${item.loadDate}</td>
                  <td>
                    <c:choose>
                      <c:when test="${item.electronicConfirm eq true}">
                        <a href="${ctx.host}/shipment-lines/${item.shipmentId}/electronic" data-target="#shipment-electronic" data-toggle="modal">是(查看详情)</a>
                      </c:when>
                      <c:otherwise>
                        <span>否</span>
                      </c:otherwise>
                    </c:choose>
                  </td>
                </tr>
                
              </c:forEach>
              
            </c:forEach>
            
          </tbody>
        </table>

        <div class="form-group ms-form-group">
          <div class="col-xs-6 col-xs-offset-3 ms-operation-group top-margin-20 text-center">
            <div class="col-xs-5">
              <button type="reset" class="btn btn-block btn-default">重置</button>
            </div>
            <div class="col-xs-5">
              <button type="submit" class="btn btn-block btn-primary">确认</button>
            </div>
          </div>
        </div>

      </form>
    
    </div> 
  </div>       
  
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource type="script" root="${ctx.resource}/build" src="js/page/business/reimburse/reimburse-order-list.js" />
  <script type="text/javascript">
    require(['page/business/reimburse/reimburse-order-list'], function(page) {
      page.init()
    })
  </script>

</body>
</html>